<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

	<h:head>
		<title>Selezione Andata</title>
	</h:head>
	
	<h:body>
		<h:form>
			<p:dataTable id="goingTable" var="transport"
				value="#{transportBean.getToDestination(transportDialogBean.destination)}" rows="10"
				paginator="true">
				<p:column headerText="Id">
					<h:outputText value="#{transport.id}" />
				</p:column>
	
				<p:column headerText="Nome">
					<h:outputText value="#{transport.name}" />
				</p:column>
	
				<p:column headerText="Origine">
					<h:outputText value="#{transport.origin}" />
				</p:column>
	
				<p:column headerText="Destinazione">
					<h:outputText value="#{transport.destination}" />
				</p:column>
	
				<p:column headerText="Prezzo">
					<h:outputText value="#{transport.price}" />
				</p:column>
	
				<p:column headerText="Seleziona">
					<p:commandButton rendered="#{transportDialogBean.selected != transport.id}" value="Seleziona"
						action="#{transportDialogBean.select(transport)}" />
					<h:outputText value="Selezionata" rendered="#{transportDialogBean.selected == transport.id}" />
				</p:column>
			</p:dataTable>
		</h:form>
	</h:body>

</html>